package com.shycloud.mido.member.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.shycloud.mido.common.core.util.R;
import com.shycloud.mido.member.api.dto.MemberV2DTO;
import com.shycloud.mido.member.api.entity.Member;
import com.shycloud.mido.member.api.entity.OrgTeacherStudent;
import com.shycloud.mido.member.api.entity.SmMemberPlayRewardInfo;
import com.shycloud.mido.member.api.entity.StudentPlayTimeDaily;
import com.shycloud.mido.member.api.vo.*;

import java.text.ParseException;
import java.util.List;
import java.util.Map;

/**
 * @author nianhua.jiang
 * @description
 * @date 2020/5/25
 */
public interface MemberServiceV2 extends IService<Member> {

	/**
	 * 分页查询会员信息
	 *
	 * @param page
	 * @param memberV2DTO
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.shycloud.mido.member.api.vo.MemberV2VO>
	 * @author nianhua.jiang
	 * @date 2020/5/22 10:05
	 */
	IPage<MemberV2VO> getMemberVosPageV2(Page page, MemberV2DTO memberV2DTO);

	/**
	 * 新增用户
	 *
	 * @param memberDTO
	 * @return boolean
	 * @author nianhua.jiang
	 * @date 2020/5/25 11:49
	 */
	R addMember(MemberV2DTO memberDTO);

	/**
	 * 更新会员信息
	 *
	 * @param memberDTO
	 * @return com.shycloud.mido.common.core.util.R
	 * @author nianhua.jiang
	 * @date 2020/5/25 15:34
	 */
	R<Boolean> updateMember(MemberV2DTO memberDTO);

	/**
	 * 获取所属关系
	 *
	 * @param id
	 * @return java.util.List<com.shycloud.mido.member.api.vo.RelationshipVO>
	 * @author nianhua.jiang
	 * @date 2020/5/26 9:59
	 */
	List<RelationshipVO> getRelationship(String id);

	/**
	 * 移除所属关系
	 *
	 * @param teacherId
	 * @return boolean
	 * @aram studentId
	 * @author nianhua.jiang
	 * @date 2020/5/26 11:21
	 */
	int removeRelationship(String studentId, String teacherId);

	/**
	 * 用户详情
	 *
	 * @param id
	 * @return com.shycloud.mido.member.api.vo.MemberDetailVO
	 * @author nianhua.jiang
	 * @date 2020/5/26 16:06
	 */
	MemberDetailVO getMemberDetail(String id);

	/**
	 * 分页获取用户vip信息
	 *
	 * @param page
	 * @param phone
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.shycloud.mido.member.api.vo.MemberV2VO>
	 * @author nianhua.jiang
	 * @date 2020/5/29 13:31
	 */
	IPage<MemberV2VO> getVipMember(Page page, String phone, String identity, Integer dayLeft,
			String startDate, String endDate);

	/**
	 * 根据手机号查询用户信息
	 *
	 * @param phone
	 * @return com.shycloud.mido.music.vo.MemberVO
	 * @author nianhua.jiang
	 * @date 2020/5/27 13:46
	 */
	MemberVO getMemberByPhone(String phone);

	/**
	 * 开通会员
	 *
	 * @param phone
	 * @param useTime
	 * @return java.lang.Boolean
	 * @author nianhua.jiang
	 * @date 2020/6/2 17:27
	 */
	Boolean addVipMember(String phone, Integer useTime);

	Boolean addVipMemberByMemberId(String memberId, Integer duration);

	/**
	 * 根据用户账号查询用户所在机构
	 *
	 * @param username
	 * @return java.lang.Throwable
	 * @author nianhua.jiang
	 * @date 2020/6/8 14:39
	 */
	List<Map<String, String>> getOrgListByUsername(String username);

	/**
	 * 登陆时获取用户详细信息
	 *
	 * @param username
	 * @return com.shycloud.mido.member.api.vo.MemberDetailForLoginVO
	 * @author nianhua.jiang
	 * @date 2020/6/23 14:25
	 */
	MemberDetailForLoginVO getUserDetail(String username);

	/**
	 * 登陆时获取用户详细信息
	 *
	 * @param identify
	 * @return com.shycloud.mido.member.api.vo.MemberDetailForLoginVO
	 * @author nianhua.jiang
	 * @date 2020/6/24 16:40
	 */
	MemberDetailForLoginVO getUserDetailByPhone(String identify);

	/**
	 * 移动端注册用户
	 *
	 * @param phone
	 * @param pwd
	 * @param showname
	 * @return com.shycloud.mido.common.core.util.R
	 * @author nianhua.jiang
	 * @date 2020/6/27 10:53
	 */
	R register(String phone, String pwd, String showname);

	/**
	 * 移动端注册用户
	 *
	 * @param phone
	 * @param pwd
	 * @param type   1-微信登录 2-IOS登录
	 * @param openId
	 * @return com.shycloud.mido.common.core.util.R
	 * @author nianhua.jiang
	 * @date 2020/6/27 10:53
	 */
	R register(String phone, String pwd, String type, String openId, String showname);

	/**
	 * 移动端更新用户信息
	 *
	 * @param
	 * @return java.lang.Boolean
	 * @author nianhua.jiang
	 * @date 2020/6/28 14:36
	 */
	Boolean updateMobileUser(Map<String, String> map);

	/**
	 * 获取提醒消息
	 *
	 * @param studentId
	 * @return java.util.List<java.lang.String>
	 * @author nianhua.jiang
	 * @date 2020/7/6 13:21
	 */
	List<String> getDing(String studentId);

	/**
	 * 更新会员个推会员标识
	 *
	 * @param memberId 会员ID
	 * @param clientId 个推会员标识
	 * @return R
	 */
	R<Boolean> updClientId(String memberId, String clientId);

	/**
	 * 扫码添加学生
	 *
	 * @param map
	 * @return Boolean
	 * @author nianhua.jiang
	 */
	OrgTeacherStudent addStudent(Map<String, Object> map);

	/**
	 * 增加学生当天累积练琴时长
	 *
	 * @param studentId
	 * @param timeSpent
	 * @param dateString
	 * @return
	 */
	Boolean addPlayTimeDaily(String studentId, int timeSpent, String dateString, String memberId)
			throws ParseException;

	/**
	 * 获取学生当天累积练琴时长
	 *
	 * @param studentId
	 * @param dateString
	 * @return
	 */
	StudentPlayTimeDaily getPlayTimeDaily(String studentId, String dateString);

	List<SmMemberPlayRewardInfo> getRewardInfo();

	Map updateMemberExp(Integer rewardId, String memberId);

	Map updateMemberPoints(Integer rewardId, String memberId);

	Map<String, Object> claimReward(String paramsJson);

	String getCode();

	String getAccount();

	String getSyMemberCount(int i, String isOld);

	OrgTeacherStudent addStudentByUsername(Map<String, Object> resMap);

	String getNewMemberHardwareCount(int i);

	boolean rollbackVip(String memberId, Integer duration);

	boolean rollbackMaster(String memberId, Integer duration);

	IPage<MidoUserDataVO> getMidoUser(Page page, String username);

	IPage<MidoOrgVO> getMidoOrgPage(Page page, String code);

	List<String> getStudentIdsByMemberId(String memberId);

	IPage<OptOperatorOldVO> getOpt(Page page, String name, String username);

	List<MidoOrganOldVO> getOrgList(String optId, String word);

	Boolean delMember(String phone, String isTeacher, String teacherId, String studentId);

	Map<String,String> saveDelMemberLog(String memberId, Integer dayCount);

	Boolean assignVip(String memberId, Integer number);
}
